I can't create a function in PGSQL via concat to get data in a loop over all json